home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
mc51bugs.zip
/
Q38837
< prev
next >
Wrap
Text File
|
1988-12-13
|
2KB
|
54 lines
Q38837 Invalid Syntax for Function Pointers in Struct Causes Hang
C Compiler
5.10 | 5.10
MS-DOS | OS/2
Summary:
In the code example below, omitting the parentheses around *foo when
creating a pointer to a function in a structure hangs both the C
Version 5.10 and QuickC Version 1.01 compilers.
Microsoft has confirmed this to be a problem in C Version 5.10 and
QuickC Version 1.01. We are researching this problem and will post new
information as it becomes available.
If this code is loaded into QuickC and then immediately compiled, the
compiler flags the syntax error, but then hangs, requiring a warm
reboot. However, if the workaround code sample below is typed directly
into QuickC (not loaded) and then run, the compiler will flag the
error and not hang. Compiling the code with C Version 5.10 hangs the
compiler with no warnings.
More Information:
The following sample code demonstrates the problem;
typedef struct
{
void *fn(); /* This should read: */
/* void (*fn)(); */
} STRUCT;
void test (void)
{;}
STRUCT a = {test};
void main (void)
{;}
struct
{
*foo() ;
}
The workaround to this problem is to use correct syntax for declaring
function pointers as shown by the following code fragment:
struct
{
void (*foo) () ;
}
Keywords: S_QuickC buglist1.01 buglist5.10
Updated 88/12/13 07:16